﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;

/// <summary>
/// Summary description for EnglishDictionary
/// </summary>
public class EnglishDictionary
{
    List<DictionaryEntry> words = new List<DictionaryEntry>();

    public List<DictionaryEntry> Words
    {
        get
        {
            return this.words;
        }
    }

	public EnglishDictionary()
	{
        readDictionary(AppDomain.CurrentDomain.BaseDirectory + "/App_Data/Dictionary.txt");
	}

    private void readDictionary(string filePath)
    {
        using (StreamReader reader = new StreamReader(filePath))
        {
            string[] dictionaryContents = reader.ReadToEnd().Split();
            foreach (string word in dictionaryContents)
            {
                if (word.Length > 0)
                {
                    words.Add(new DictionaryEntry(word));
                }
            }
        }
    }

}